﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace EasyLoger
{
    internal class DataBase
    {
        public static void RunSql(string connstr, string sql, SqlParameter[] prams)
        {
            using (SqlConnection sqlConnection = new SqlConnection(connstr))
            {
                SqlCommand sqlCommand = new SqlCommand();
                sqlCommand.CommandText = sql;
                sqlCommand.CommandType = CommandType.Text;
                sqlCommand.Connection = sqlConnection;
                sqlConnection.Open();
                for (int i = 0; i < prams.Length; i++)
                {
                    SqlParameter value = prams[i];
                    sqlCommand.Parameters.Add(value);
                }
                sqlCommand.ExecuteNonQuery();
                sqlConnection.Close();
            }
        }
    }
}
